from app import app, db

# 导入所有模型
from infrastructure.po.mode.application import Application
from infrastructure.po.mode.user import User
from infrastructure.po.mode.role import Role
from infrastructure.po.mode.user_role import UserRole
from infrastructure.po.mode.resource import Resource
from infrastructure.po.mode.resource_type import ResourceType
from infrastructure.po.mode.role_resource import RoleResource
from infrastructure.po.mode.dict_type import DictType
from infrastructure.po.mode.dict_data import DictData


def create_tables():
    with app.app_context():
        db.create_all()
        print("所有数据表创建成功！")

        from sqlalchemy import inspect
        inspector = inspect(db.engine)
        tables = inspector.get_table_names()
        print(f"当前数据库中的表: {tables}")


if __name__ == "__main__":
    create_tables()